//
//  JCMainPageViewController.m
//  ABookOfCartoon
//
//  Created by 美国大狗 on 15-5-13.
//  Copyright (c) 2015年 Power Of Ants. All rights reserved.
//

#import "JCMainPageViewController.h"
#import "JCMainCollectionViewCell.h"
#import "UIImageView+WebCache.h"
#import "JCDetailsViewController.h"
#import "JCReadViewController.h"
#import "MJRefresh.h"
#import "NetworkHandle.h"
#import "MBProgressHUD.h"
#import "JCMainPageModel.h"

@interface JCMainPageViewController ()<UICollectionViewDelegate,UICollectionViewDataSource,UIScrollViewDelegate>

@property(nonatomic,retain)UIView *naView;
@property(nonatomic,retain)UIButton *JapanButton;
@property(nonatomic,retain)UIButton *ChinaButton;
@property(nonatomic,retain)UIButton *KoreaButton;
@property(nonatomic,retain)UIButton *EAndAButton;
@property(nonatomic,retain)UIPageControl *page;
@property (nonatomic, retain)NSMutableArray *dataArr;
@property(nonatomic,retain)UICollectionView *collectionView;
@property(nonatomic,retain)UICollectionView *collectionView1;
@property(nonatomic,retain)UICollectionView *collectionView2;
@property(nonatomic,retain)UICollectionView *collectionView3;
@property(nonatomic,retain)UIScrollView *scrollView;
@property(nonatomic,retain)NSMutableArray *arr;
@property(nonatomic,retain)UIScrollView *scrollView1;
@property(nonatomic,retain)UILabel *label;
@property(nonatomic,retain)UILabel *label1;
@property(nonatomic,retain)UILabel *label2;
@property(nonatomic,retain)UILabel *label3;
@property(nonatomic,retain)UIView *view1;
@property(nonatomic,retain)NSString *str0;

@end

@implementation JCMainPageViewController

- (void)dealloc
{
    [_naView release];
    [super dealloc];
}


//隐藏首页navigationBar
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = YES;
    self.tabBarController.tabBar.hidden = NO;
    self.navigationController.navigationBar.translucent = NO;
    self.tabBarController.tabBar.translucent = NO;
    _ChinaButton.titleLabel.font = [UIFont systemFontOfSize:30];
    _JapanButton.titleLabel.font = [UIFont systemFontOfSize:17];
    _KoreaButton.titleLabel.font = [UIFont systemFontOfSize:17];
    _EAndAButton.titleLabel.font = [UIFont systemFontOfSize:17];
    
    _label.backgroundColor = [UIColor greenColor];
    _label1.backgroundColor = [UIColor orangeColor];
    _label2.backgroundColor = [UIColor orangeColor];
    _label3.backgroundColor = [UIColor orangeColor];
    [self addHeader];
    
    
 
    [self.view reloadInputViews];
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self china];
//
    [self addHeader];
    
    
    

    //   页面scrollView
    self.scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width * 4, self.view.frame.size.height)];
    [self.view addSubview:_scrollView];
    self.tabBarController.tabBar.translucent = NO;
    self.tabBarController.tabBar.tintColor = [UIColor orangeColor];
    
    //  头部标签部分View
    self.naView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 60)];
    _naView.userInteractionEnabled = YES;
    [self.view addSubview:_naView];
    [_naView release];
    
    
    //  中BUTTON
    self.ChinaButton = [UIButton buttonWithType:UIButtonTypeSystem];
    _ChinaButton.frame = CGRectMake(0, 20, self.view.bounds.size.width / 4, 55);
    [_ChinaButton setTitle:@"中" forState:UIControlStateNormal];
    _ChinaButton.backgroundColor = [UIColor orangeColor];
    _ChinaButton.titleLabel.font = [UIFont systemFontOfSize:30];
    [_ChinaButton addTarget:self action:@selector(china) forControlEvents:UIControlEventTouchUpInside];
    self.str0 = @"0";
    [_ChinaButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
   [_naView addSubview:_ChinaButton];
    
    
    //  日BUTTON
    self.JapanButton = [UIButton buttonWithType:UIButtonTypeSystem];
    _JapanButton.frame = CGRectMake(self.view.bounds.size.width / 4, 20, self.view.bounds.size.width / 4, 55);
    [_JapanButton setTitle:@"日" forState:UIControlStateNormal];
    _JapanButton.backgroundColor = [UIColor orangeColor];
    _JapanButton.titleLabel.font = [UIFont systemFontOfSize:17];
    [_JapanButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    self.str0 = @"1";
    [_JapanButton addTarget:self action:@selector(Japan:) forControlEvents:UIControlEventTouchUpInside];
    [_naView addSubview:_JapanButton];
    
    
    //  韩BUTTON
    self.KoreaButton = [UIButton buttonWithType:UIButtonTypeSystem];
    _KoreaButton.frame = CGRectMake(self.view.bounds.size.width * 2 / 4, 20, self.view.bounds.size.width / 4, 55);
    [_KoreaButton setTitle:@"韩" forState:UIControlStateNormal];
    _KoreaButton.backgroundColor = [UIColor orangeColor];
    _KoreaButton.titleLabel.font = [UIFont systemFontOfSize:17];
    [_KoreaButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [_KoreaButton addTarget:self action:@selector(Korea) forControlEvents:UIControlEventTouchUpInside];
    self.str0 = @"2";
    [_naView addSubview:_KoreaButton];
    
    
    //  欧美BUTTON
    self.EAndAButton = [UIButton buttonWithType:UIButtonTypeSystem];
    _EAndAButton.frame = CGRectMake(self.view.bounds.size.width * 3 / 4, 20, self.view.bounds.size.width / 4, 55);
    [_EAndAButton setTitle:@"欧美" forState:UIControlStateNormal];
    _EAndAButton.backgroundColor = [UIColor orangeColor];
    _EAndAButton.titleLabel.font = [UIFont systemFontOfSize:17];
    [_EAndAButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [_EAndAButton addTarget:self action:@selector(EAndA) forControlEvents:UIControlEventTouchUpInside];
    [_naView addSubview:_EAndAButton];
    
    //小白点
    self.page = [[UIPageControl alloc]initWithFrame:CGRectMake(20, 110, 100, 40)];
    _page.numberOfPages = 3;
    _page.pageIndicatorTintColor = [UIColor blackColor];
    
    //轮播图后scrollView
    self.scrollView1 = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 160)];
    _scrollView1.backgroundColor = [UIColor redColor];
    _scrollView1.contentSize = CGSizeMake(self.view.frame.size.width * 3, 160);
    _scrollView1.pagingEnabled = YES;
    _scrollView1.delegate = self;
    self.view1 = [[UIView alloc]initWithFrame:CGRectMake(0, 75, self.view.frame.size.width, 10)];
    [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(changePicture) userInfo:nil repeats:YES];
    _view1.backgroundColor = [UIColor orangeColor];
    [_naView addSubview:_view1];
    
    //button上小绿线
    self.label = [[UILabel alloc]initWithFrame:CGRectMake(self.ChinaButton.frame.size.width / 2 - 11, 45, 20, 5)];
    _label.backgroundColor = [UIColor greenColor];
    [_ChinaButton addSubview:_label];
    
    self.label1 = [[UILabel alloc]initWithFrame:CGRectMake(self.ChinaButton.frame.size.width / 2 - 11, 45, 20, 5)];
    _label1.backgroundColor = [UIColor orangeColor];
    [_JapanButton addSubview:_label1];
    
    self.label2 = [[UILabel alloc]initWithFrame:CGRectMake(self.ChinaButton.frame.size.width / 2 - 11, 45, 20, 5)];
    _label2.backgroundColor = [UIColor orangeColor];
    [_KoreaButton addSubview:_label2];
    
    self.label3 = [[UILabel alloc]initWithFrame:CGRectMake(self.ChinaButton.frame.size.width / 2 - 11, 45, 20, 5)];
    _label3.backgroundColor = [UIColor orangeColor];
    [_EAndAButton addSubview:_label3];
    
    // 小菊花
    MBProgressHUD *HUD = [[MBProgressHUD alloc] initWithView:self.view];
    [self.view addSubview:HUD];
    
    //如果设置此属性则当前的view置于后台
    HUD.dimBackground = YES;
    
    //设置对话框文字
    HUD.labelText = @"请稍等";
    
    //显示对话框
    [HUD showAnimated:YES whileExecutingBlock:^{
        //对话框显示时需要执行的操作
        sleep(1);   // 数字是显示的时间
    } completionBlock:^{
        //操作执行完后取消对话框
        [HUD removeFromSuperview];
        [HUD release];
        MBProgressHUD  *HUD = nil;
        // 又开始一遍 后台执行并显示出来, 在加载真正视图之前
        HUD = [[MBProgressHUD alloc] initWithView:self.view];
        [self.view addSubview:HUD];
        HUD.labelText = @"加载成功";
        HUD.mode = 	MBProgressHUDModeCustomView // 类型
        ;
        // 加载完成后显示了一个图片视图 时间为 5秒
        HUD.customView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"/Users/dlios/ABookOfCartoon/ABookOfCartoon/aihua.png"]] autorelease];
        [HUD showAnimated:YES whileExecutingBlock:^{
            sleep(1); // 时间
        } completionBlock:^{
            [HUD removeFromSuperview];
            [HUD release];
        }];
        
    }];

    
}

int  i = 1001;
- (void)changePicture
{
    _scrollView1.contentOffset = CGPointMake(self.view.frame.size.width * (i - 1001), 0);
    i++;
    if (i == 1004) {
        i = 1001;
    }
    
}
//小白点偏移
-(void)page:(UIPageControl *)page
{
    _scrollView1.contentOffset = CGPointMake(page.currentPage * self.view.frame.size.width, 0);
}

//  轮播图 图片获取
-(void) img
{
    UIImageView *img = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 160)];
    [img sd_setImageWithURL:[NSURL URLWithString:[_arr objectAtIndex:0]]placeholderImage:[UIImage imageNamed:@"/Users/dlios/ABookOfCartoon/ABookOfCartoon/9.jpg"]];
    [_scrollView1 addSubview:img];
    img.backgroundColor = [UIColor purpleColor];
    [img release];
    
    UIImageView *img1 = [[UIImageView alloc] initWithFrame:CGRectMake(self.view.frame.size.width, 0, self.view.frame.size.width, 160)];
    [img1 sd_setImageWithURL:[NSURL URLWithString:[_arr objectAtIndex:1]]placeholderImage:[UIImage imageNamed:@"/Users/dlios/ABookOfCartoon/ABookOfCartoon/9.jpg"]];
    [_scrollView1 addSubview:img1];
    img1.backgroundColor = [UIColor purpleColor];
    [img1 release];
    
    UIImageView *img2 = [[UIImageView alloc] initWithFrame:CGRectMake(self.view.frame.size.width * 2, 0, self.view.frame.size.width, 160)];
    [img2 sd_setImageWithURL:[NSURL URLWithString:[_arr objectAtIndex:2]]placeholderImage:[UIImage imageNamed:@"/Users/dlios/ABookOfCartoon/ABookOfCartoon/9.jpg"]];
    [_scrollView1 addSubview:img2];
    img2.backgroundColor = [UIColor purpleColor];
    [img2 release];
}


//  BUTTON调用
-(void)china
{
    [self creatCollectionView];
    [self getDataFromWeb];
     _scrollView.contentOffset = CGPointMake(0, -20);
    _ChinaButton.titleLabel.font = [UIFont systemFontOfSize:30];
    _JapanButton.titleLabel.font = [UIFont systemFontOfSize:17];
    _KoreaButton.titleLabel.font = [UIFont systemFontOfSize:17];
    _EAndAButton.titleLabel.font = [UIFont systemFontOfSize:17];
    
    _label.backgroundColor = [UIColor greenColor];
    _label1.backgroundColor = [UIColor orangeColor];
    _label2.backgroundColor = [UIColor orangeColor];
    _label3.backgroundColor = [UIColor orangeColor];
    self.isUpLoading = NO;
    [self addHeader];
}

-(void)Japan:(UIButton *)btn
{
    [self creatCollectionView1];
    [self getdatafromweb1];
    _scrollView.contentOffset = CGPointMake(375, -20);
    _ChinaButton.titleLabel.font = [UIFont systemFontOfSize:17];
    _JapanButton.titleLabel.font = [UIFont systemFontOfSize:30];
    _KoreaButton.titleLabel.font = [UIFont systemFontOfSize:17];
    _EAndAButton.titleLabel.font = [UIFont systemFontOfSize:17];
    
    _label.backgroundColor = [UIColor orangeColor];
    _label1.backgroundColor = [UIColor greenColor];
    _label2.backgroundColor = [UIColor orangeColor];
    _label3.backgroundColor = [UIColor orangeColor];
    self.isUpLoading = NO;
    [self addHeader1];
    
}
-(void)Korea
{
    [self getdatafromweb2];
    [self creatCollectionView2];
    _scrollView.contentOffset = CGPointMake(375 * 2, -20);
    _ChinaButton.titleLabel.font = [UIFont systemFontOfSize:17];
    _JapanButton.titleLabel.font = [UIFont systemFontOfSize:17];
    _KoreaButton.titleLabel.font = [UIFont systemFontOfSize:30];
    _EAndAButton.titleLabel.font = [UIFont systemFontOfSize:17];
    
    _label.backgroundColor = [UIColor orangeColor];
    _label1.backgroundColor = [UIColor orangeColor];
    _label2.backgroundColor = [UIColor greenColor];
    _label3.backgroundColor = [UIColor orangeColor];
    self.isUpLoading = NO;
    [self addHeader2];
}

-(void)EAndA
{
    [self getdatafromweb3];
    [self creatCollectionView3];
    _scrollView.contentOffset = CGPointMake(375 * 3, -20);
    _ChinaButton.titleLabel.font = [UIFont systemFontOfSize:17];
    _JapanButton.titleLabel.font = [UIFont systemFontOfSize:17];
    _KoreaButton.titleLabel.font = [UIFont systemFontOfSize:17];
    _EAndAButton.titleLabel.font = [UIFont systemFontOfSize:30];
    
    _label.backgroundColor = [UIColor orangeColor];
    _label1.backgroundColor = [UIColor orangeColor];
    _label2.backgroundColor = [UIColor orangeColor];
    _label3.backgroundColor = [UIColor greenColor];
    [self addHeader3];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

// 中页面
-(void)creatCollectionView
{
    UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init];
    layout.itemSize = CGSizeMake(100, 180);
    layout.minimumInteritemSpacing = 3;
    layout.minimumLineSpacing = 10;
    layout.sectionInset = UIEdgeInsetsMake(165, 30, 5, 30);
    
    self.collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 64, self.view.frame.size.width, self.view.frame.size.height - 44) collectionViewLayout:layout];
    _collectionView.delegate = self;
    _collectionView.dataSource = self;
    _collectionView.backgroundColor = [UIColor whiteColor];
    [self.scrollView addSubview:_collectionView];
    [_collectionView release];
    [layout release];
    
    [_collectionView registerClass:[JCMainCollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
    _collectionView.contentInset = UIEdgeInsetsMake(0, 0, 40, 0);
    [_collectionView addSubview:_scrollView1];
    [_collectionView addSubview:_page];
}


// 日页面
-(void)creatCollectionView1
{
    UICollectionViewFlowLayout *layout1 = [[UICollectionViewFlowLayout alloc]init];
    layout1.itemSize = CGSizeMake(100, 180);
    layout1.minimumInteritemSpacing = 3;
    layout1.minimumLineSpacing = 10;

//    layout1.sectionInset = UIEdgeInsetsMake(145, 30, 5, 30);
//    layout1.sectionInset = UIEdgeInsetsMake(145, 55, 5, 30);

    layout1.sectionInset = UIEdgeInsetsMake(165, 30, 5, 30);

    
    self.collectionView1 = [[UICollectionView alloc]initWithFrame:CGRectMake(375, 64, self.view.frame.size.width, self.view.frame.size.height - 44) collectionViewLayout:layout1];
    _collectionView1.delegate = self;
    _collectionView1.dataSource = self;
    [self.scrollView addSubview:_collectionView1];
    _collectionView1.backgroundColor = [UIColor whiteColor];
    [_collectionView1 release];
    [layout1 release];
    
    [_collectionView1 registerClass:[JCMainCollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
    _collectionView1.contentInset = UIEdgeInsetsMake(0, 0, 40, 0);
    [_collectionView1 addSubview:_scrollView1];
    [_collectionView1 addSubview:_page];
}


//  韩页面
-(void)creatCollectionView2
{
    UICollectionViewFlowLayout *layout2 = [[UICollectionViewFlowLayout alloc]init];
    layout2.itemSize = CGSizeMake(100, 180);
    layout2.minimumInteritemSpacing = 3;
    layout2.minimumLineSpacing = 10;
    layout2.sectionInset = UIEdgeInsetsMake(165, 30, 5, 30);
    
    self.collectionView2 = [[UICollectionView alloc]initWithFrame:CGRectMake(375 * 2, 64, self.view.frame.size.width, self.view.frame.size.height - 44) collectionViewLayout:layout2];
    _collectionView2.delegate = self;
    _collectionView2.dataSource = self;
    _collectionView2.backgroundColor = [UIColor whiteColor];
    [self.scrollView addSubview:_collectionView2];
    [_collectionView2 release];
    [layout2 release];
    
    [_collectionView2 registerClass:[JCMainCollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
    _collectionView2.contentInset = UIEdgeInsetsMake(0, 0, 40, 0);
    [_collectionView2 addSubview:_scrollView1];
    [_collectionView2 addSubview:_page];
}


//  欧美页面
-(void)creatCollectionView3
{
    UICollectionViewFlowLayout *layout3 = [[UICollectionViewFlowLayout alloc]init];
    layout3.itemSize = CGSizeMake(100, 180);
    layout3.minimumInteritemSpacing = 3;
    layout3.minimumLineSpacing = 10;
    layout3.sectionInset = UIEdgeInsetsMake(165, 30, 5, 30);
    
    self.collectionView3 = [[UICollectionView alloc]initWithFrame:CGRectMake(375 * 3, 64, self.view.frame.size.width, self.view.frame.size.height - 44) collectionViewLayout:layout3];
    _collectionView3.delegate = self;
    _collectionView3.dataSource = self;
    _collectionView3.backgroundColor = [UIColor whiteColor];
    [self.scrollView addSubview:_collectionView3];
    [_collectionView3 release];
    [layout3 release];
    
    [_collectionView3 registerClass:[JCMainCollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
    
    _collectionView3.contentInset = UIEdgeInsetsMake(0, 0, 40, 0);
    [_collectionView3 addSubview:_scrollView1];
    [_collectionView3 addSubview:_page];
}


-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return _dataArr.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
   JCMainCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
    JCMainPageModel *mo = [[JCMainPageModel alloc] init];
    mo.BookName = [[_dataArr objectAtIndex:indexPath.item]BookName];
    mo.BookIconOtherURL = [[_dataArr objectAtIndex:indexPath.item]BookIconOtherURL];
    cell.model = mo;
    return cell;
}

//点击方法:
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    [collectionView deselectItemAtIndexPath:indexPath animated:YES];
    JCDetailsViewController *detail = [[JCDetailsViewController alloc]init];
    [self.navigationController pushViewController:detail animated:YES];
    JCMainPageModel *h = _dataArr[indexPath.row];
    detail.str = h.BookName;
    detail.str1 = h.BookIconOtherURL;
    detail.str2 = h.BookName;
    detail.str3 = h.BookAuthor;
    detail.str4 = [[[NSNumberFormatter alloc] init]stringFromNumber:h.BookClickCount];
    detail.str5 = h.BookDescription;
    detail.str6 = h.BookID;
    
    
}

-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    _page.currentPage = _scrollView1.contentOffset.x / self.view.frame.size.width;
    if (_scrollView1.contentOffset.x > self.view.frame.size.width * 2) {
        _scrollView1.contentOffset = CGPointMake(0, 0);
    }
    if (_scrollView1.contentOffset.x < 0) {
        _scrollView1.contentOffset = CGPointMake(self.view.frame.size.width * 2, 0);
    }
}

#pragma mark - 下拉刷新
- (void)addHeader
{
    __block JCMainPageViewController *vc = self;
    [_collectionView addLegendHeaderWithRefreshingBlock:^{
      [vc getDataFromWeb];//重新请求数据
    }];
      [self.collectionView.header beginRefreshing];
}
-(void)addHeader1
{
     __block JCMainPageViewController *vc = self;
    [_collectionView1 addLegendHeaderWithRefreshingBlock:^{
    [vc getdatafromweb1];//重新请求数据
    }];
     [self.collectionView1.header beginRefreshing];
}
-(void)addHeader2
{
     __block JCMainPageViewController *vc = self;
    [_collectionView2 addLegendHeaderWithRefreshingBlock:^{
    [vc getdatafromweb2];//重新请求数据
    }];
    [self.collectionView2.header beginRefreshing];
}
-(void)addHeader3
{
     __block JCMainPageViewController *vc = self;
    [_collectionView3 addLegendHeaderWithRefreshingBlock:^{
    [vc getdatafromweb3];//重新请求数据
    }];
    [self.collectionView3.header beginRefreshing];
}

//  中页面获取网络数据
-(void)getDataFromWeb
{
    [NetworkHandle getDataWithURL:@"http://112.124.96.190:9090/manhuadaquan4appjobs/ComicHandle.ashx?method=booklist&pageSize=20&cataID=60&state=0&order=0&pageIndex=0" completion:^(id result) {
        
        self.dataArr = [[NSMutableArray array] init];
        self.arr = [NSMutableArray array];
        NSDictionary *arr = result;
        NSMutableArray *sarr = [arr objectForKey:@"Booklist"];
        for (NSMutableDictionary *dic in sarr) {
            JCMainPageModel *m = [[JCMainPageModel alloc]initWithDic:dic];
            
            [self.arr addObject:[dic objectForKey:@"BookIconOtherURL"]];
            [_dataArr addObject:m];
            [m release];
        }
        [self creatCollectionView];
        [self img];
    }];
    
}


//  日页面获取网络数据
-(void)getdatafromweb1
{
   [NetworkHandle getDataWithURL:@"http://112.124.96.190:9090/manhuadaquan4appjobs/ComicHandle.ashx?method=booklist&pageSize=20&cataID=61&state=0&order=0&pageIndex=0" completion:^(id result) {
       
       self.dataArr = [[NSMutableArray array] init];
       self.arr = [NSMutableArray array];
       NSDictionary *arr = result;
       NSMutableArray *sarr = [arr objectForKey:@"Booklist"];
       for (NSMutableDictionary *dic in sarr) {
           JCMainPageModel *m = [[JCMainPageModel alloc]initWithDic:dic];[self.arr addObject:[dic objectForKey:@"BookIconOtherURL"]];
           [_dataArr addObject:m];
           [m release];
       }
       [self creatCollectionView1];
       [self img];
       [self.collectionView1 reloadData];
   }];
}


//  韩页面获取网络数据
-(void)getdatafromweb2
{
    
    [NetworkHandle getDataWithURL:@"http://112.124.96.190:9090/manhuadaquan4appjobs/ComicHandle.ashx?method=booklist&pageSize=20&cataID=81&state=0&order=0&pageIndex=0" completion:^(id result) {
        
        self.dataArr = [[NSMutableArray array] init];
        self.arr = [NSMutableArray array];
        NSDictionary *arr = result;
        NSMutableArray *sarr = [arr objectForKey:@"Booklist"];
        for (NSMutableDictionary *dic in sarr) {
            JCMainPageModel *m = [[JCMainPageModel alloc]initWithDic:dic];
            [self.arr addObject:[dic objectForKey:@"BookIconOtherURL"]];
            [_dataArr addObject:m];
            [m release];
        }
        [self creatCollectionView2];
        [self img];
        [self.collectionView2 reloadData];
    }];
}


// 欧美页面获取网络数据
-(void)getdatafromweb3
{
    
    [NetworkHandle getDataWithURL:@"http://112.124.96.190:9090/manhuadaquan4appjobs/ComicHandle.ashx?method=booklist&pageSize=20&cataID=63&state=0&order=0&pageIndex=0" completion:^(id result) {
        
        self.dataArr = [[NSMutableArray array] init];
        self.arr = [NSMutableArray array];
        NSDictionary *arr = result;
        NSMutableArray *sarr = [arr objectForKey:@"Booklist"];
        for (NSMutableDictionary *dic in sarr) {
            JCMainPageModel *m = [[JCMainPageModel alloc]initWithDic:dic];
            [self.arr addObject:[dic objectForKey:@"BookIconOtherURL"]];
            [_dataArr addObject:m];
            [m release];
        }
        [self creatCollectionView3];
        [self img];
        [self collectionView3];
    }];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
